package com.dy.design_pattern_study.chain_of_responsibility_pattern.dome1;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-22
 * @Content
 */
public class client {
    public static void main(String[] args) {

        //三个管理者
        Manager personA = new Manager("经理");
        Manager personB = new Manager("总监");
        Manager personC = new Manager("总经理");

        Request request = new Request();
        request.setRequestType("加薪");
        request.setRequestContent("请求加薪");
        request.setNumber(1000);

        //加薪请求
        returnRequest(personA, personB, personC, request);

        Request request1 = new Request();
        request1.setRequestType("请假");
        request1.setRequestContent("请假3天");
        request1.setNumber(3);

        //请假请求
        returnRequest(personA, personB, personC, request1);

    }

    /**
     * 不同管理者都有不同的返回
     * @param personA
     * @param personB
     * @param personC
     * @param request1
     */
    private static void returnRequest(Manager personA, Manager personB, Manager personC, Request request1) {
        personA.getResult("经理", request1);
        personB.getResult("总监", request1);
        personC.getResult("总经理", request1);
    }


}
